package com.gagakuai.demo.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/*
 * @program: settement
 * @description: 日志切面
 * @author: houhong
 * @create: 2022-11-13 15:41
 */
@Aspect
@Component
public class LogAspect {

    @Pointcut("execution(* com.gagakuai.demo.aop.user..*(..))")
    public void pointCut() {
    }


    @Before("pointCut()")
    public void beforeMethod() {
        System.out.println("前置处理");
    }

    @After("pointCut()")
    public void afterMethod() {
        System.out.println("后置处理");
    }

    @AfterReturning("pointCut()")
    public Object returnAspect() {
        System.out.println("返回处理");
        return "houhong";
    }

    @AfterThrowing("pointCut()")
    public void afterThrowing() {
        System.out.println("异常");
    }

}